home *** CD-ROM | disk | FTP | other *** search
- on myPath
- set myFile to new(xtra("fileio"))
- setFilterMask(myFile, EMPTY)
- set fileName to displayOpen(myFile)
- end
-
- on CreateInitFiles
- global gInitText, gInitState, gFolderName, gFileName, gOutText, gDelimiter, gDataPath, gTeacherCD
- set errorcode to 0
- if the last char in gInitText = RETURN then
- set errorcode to 1
- end if
- if errorcode = 0 then
- if the platform contains "Windows" then
- set Pathname1 to "C:\WINDOWS\"
- else
- set checkpref to misc_x(mnew)
- set Pathname1 to checkpref(mPrefsFolder)
- end if
- set gFolderName to "eapinit.ctx"
- set errorcode to CreateDirectory(Pathname1 & "eapinit.ctx")
- if errorcode <> 0 then
- set errorcode to 2
- end if
- end if
- if errorcode = 0 then
- set gFileName to "eap.ini"
- set gOutText to gInitText
- if (gInitState = 124) or (gInitState = 127) then
- if char length(gOutText) - 8 to length(gOutText) of gOutText = ("eapscore" & gDelimiter) then
- set gOutText to char 1 to length(gOutText) - 9 of gOutText
- set errorcode to 0
- else
- set errorcode to 3
- end if
- set gDataPath to gOutText
- end if
- if errorcode = 0 then
- set errorcode to createText(Pathname1)
- if errorcode = 0 then
- set errorcode to writeText(Pathname1)
- if errorcode <> 0 then
- set errorcode to 5
- end if
- else
- set errorcode to 4
- end if
- end if
- end if
- if (errorcode = 0) and ((gInitState = 123) or (gInitState = 125) or (gInitState = 126)) then
- if the platform contains "Windows" then
- set Pathname2 to line 2 of gOutText
- else
- set checkpref to misc_x(mnew)
- set Pathname2 to line 2 of gOutText
- end if
- set gFolderName to "eapscore"
- set errorcode to CreateDirectory(Pathname2 & "eapscore")
- if errorcode <> 0 then
- set errorcode to 6
- else
- set gDataPath to Pathname2
- end if
- end if
- if (errorcode = 0) and ((gInitState = 123) or (gInitState = 125) or (gInitState = 126)) then
- if the platform contains "Windows" then
- set Pathname3 to Pathname2 & "eapscore\"
- else
- set checkpref to misc_x(mnew)
- set Pathname3 to Pathname2 & "eapscore:"
- end if
- set gFolderName to "Class"
- set errorcode to CreateDirectory(Pathname3 & "Class")
- if errorcode <> 0 then
- set errorcode to 7
- end if
- end if
- if (errorcode = 0) and ((gInitState = 123) or (gInitState = 125) or (gInitState = 126)) then
- set gFileName to "Token"
- set gOutText to "[0,0]"
- set errorcode to createText(Pathname3)
- if errorcode = 0 then
- set errorcode to writeText(Pathname3)
- if errorcode <> 0 then
- set errorcode to 9
- end if
- else
- set errorcode to 8
- end if
- end if
- if errorcode = 0 then
- case gTeacherCD of
- 0:
- PopUpWinCall(12, "Y", "Setup Complete")
- 1:
- PopUpWinCall(12, "Y", "Setup Complete-Teacher")
- end case
- else
- if errorcode > 8 then
- DeleteFile(Pathname3 & "Class" & gDelimiter & "Token")
- end if
- if errorcode > 7 then
- DeleteDirectory(Pathname3 & "Class")
- end if
- if errorcode > 6 then
- DeleteDirectory(Pathname3)
- end if
- if errorcode > 4 then
- DeleteFile(Pathname1 & "eapinit.ctx" & gDelimiter & "eap.ini")
- end if
- if errorcode > 2 then
- DeleteDirectory(Pathname1 & "eapinit.ctx")
- end if
- case gTeacherCD of
- 0:
- PopUpWinCall(12, "Y", "Setup Error")
- 1:
- PopUpWinCall(12, "Y", "Setup Error-Teacher")
- end case
- end if
- end
-
- on selectFolder thePath
- global gPickFolderObject
- if not stringp(thePath) then
- set thePath to the pathName
- end if
- insurePickFolder()
- set theFolder to gPickFolderObject(mGetSelectedFolder, thePath)
- if theFolder = EMPTY then
- set theErr to gPickFolderObject(mError)
- if theErr <> 9 then
- alert("selectFolder() error: " & gPickFolderObject(mErrorString))
- end if
- end if
- return theFolder
- end
-
- on pickFolderError
- global gPickFolderObject
- insurePickFolder()
- return gPickFolderObject(mError)
- end
-
- on pickFolderErrorString
- global gPickFolderObject
- insurePickFolder()
- return gPickFolderObject(mErrorString)
- end
-
- on openPickFolder
- if objectp(factory("PickFolder")) then
- return 1
- end if
- if the machineType < 256 then
- openXLib("PickFolder XObject")
- else
- openXLib("pickfold.dll")
- end if
- if not objectp(factory("PickFolder")) then
- alert("PickFolder XObject didn't register.")
- return 0
- end if
- return 1
- end
-
- on closePickFolder
- global gPickFolderObject, gVoid
- if objectp(gPickFolderObject) then
- gPickFolderObject(mdispose)
- end if
- if not objectp(factory("PickFolder")) then
- return 1
- end if
- if the machineType < 256 then
- closeXLib("PickFolder XObject")
- else
- closeXLib("pickfold.dll")
- end if
- if objectp(factory("PickFolder")) then
- alert("PickFolder XObject wouldn't close.")
- return 0
- end if
- return 1
- end
-
- on insurePickFolder
- global gPickFolderObject
- if objectp(gPickFolderObject) then
- return 1
- end if
- if not openPickFolder() then
- alert("insurePickFolder(): openPickFolder() failed")
- abort()
- end if
- set gPickFolderObject to PickFolder(mnew)
- if not objectp(gPickFolderObject) then
- alert("insurePickFolder(): couldn't create object")
- abort()
- end if
- return 1
- end
-
- on xobjectLoaded theName
- if not stringp(theName) then
- alert("xobjectLoaded(): theName not a string")
- return 0
- end if
- if objectp(factory(theName)) then
- return 1
- end if
- return 0
- end
-
- on InitSections
- global g1SectionList, g2SectionList, g3SectionList, g4SectionList, g5SectionList, g6SectionList, g7SectionList, g8SectionList, g12SectionList, g13SectionList, g9SectionList, g10SectionList, g11SectionList
- set g1SectionList to list(0, 0, 0, 0)
- set g2SectionList to list(0, 0, 0, 0)
- set g3SectionList to list(0, 0, 0, 0)
- set g4SectionList to list(0, 0, 0, 0)
- set g5SectionList to list(0, 0, 0, 0)
- set g6SectionList to list(0, 0, 0, 0)
- set g7SectionList to list(0, 0, 0, 0)
- set g8SectionList to list(0, 0, 0, 0)
- set g9SectionList to list(0, 0, 0, 0)
- set g10SectionList to list(0, 0, 0, 0)
- set g11SectionList to list(0, 0, 0, 0)
- set g12SectionList to list(0, 0, 0, 0)
- set g13SectionList to list(0, 0, 0, 0)
- end
-